<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Classes  Reference</title>
    <link rel="stylesheet" type="text/css" href="css/jazzy.css" />
    <link rel="stylesheet" type="text/css" href="css/highlight.css" />
    <meta charset='utf-8'>
    <script src="js/jquery.min.js" defer></script>
    <script src="js/jazzy.js" defer></script>
    
    <script src="js/lunr.min.js" defer></script>
    <script src="js/typeahead.jquery.js" defer></script>
    <script src="js/jazzy.search.js" defer></script>
  </head>
  <body>
    <a name="//apple_ref/swift/Section/Classes" class="dashAnchor"></a>
    <a title="Classes  Reference"></a>
    <header>
      <div class="content-wrapper">
        <p><a href="index.html">RxBluetoothKit 7.0.0 Docs</a> (82% documented)</p>
        <p class="header-right"><a href="https://github.com/Polidea/RxBluetoothKit"><img src="img/gh.png"/>View on GitHub</a></p>
        <p class="header-right">
          <form role="search" action="search.json">
            <input type="text" placeholder="Search documentation" data-typeahead>
          </form>
        </p>
      </div>
    </header>
    <div class="content-wrapper">
      <p id="breadcrumbs">
        <a href="index.html">RxBluetoothKit Reference</a>
        <img id="carat" src="img/carat.png" />
        Classes  Reference
      </p>
    </div>
    <div class="content-wrapper">
      <nav class="sidebar">
        <ul class="nav-groups">
          <li class="nav-group-name">
            <a href="Classes.html">Classes</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Classes/CentralManager.html">CentralManager</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/Characteristic.html">Characteristic</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/Descriptor.html">Descriptor</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/Peripheral.html">Peripheral</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/PeripheralManager.html">PeripheralManager</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/RxBluetoothKitLog.html">RxBluetoothKitLog</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/RxBluetoothKitLog/LogLevel.html">– LogLevel</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/ScannedPeripheral.html">ScannedPeripheral</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/Service.html">Service</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="Enums.html">Enumerations</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Enums/BluetoothError.html">BluetoothError</a>
              </li>
              <li class="nav-group-task">
                <a href="Enums/BluetoothState.html">BluetoothState</a>
              </li>
              <li class="nav-group-task">
                <a href="Enums/RxBluetoothKitLogger.html">RxBluetoothKitLogger</a>
              </li>
              <li class="nav-group-task">
                <a href="Enums/StartAdvertisingResult.html">StartAdvertisingResult</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="Extensions.html">Extensions</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Extensions/Reactive.html">Reactive</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="Functions.html">Functions</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Functions.html#/s:14RxBluetoothKit2eeoiySbAA0B5ErrorO_ADtF">==(_:_:)</a>
              </li>
              <li class="nav-group-task">
                <a href="Functions.html#/s:14RxBluetoothKit2eeoiySbAA10DescriptorC_ADtF">==(_:_:)</a>
              </li>
              <li class="nav-group-task">
                <a href="Functions.html#/s:14RxBluetoothKit2eeoiySbAA10PeripheralC_ADtF">==(_:_:)</a>
              </li>
              <li class="nav-group-task">
                <a href="Functions.html#/s:14RxBluetoothKit2eeoiySbAA14CharacteristicC_ADtF">==(_:_:)</a>
              </li>
              <li class="nav-group-task">
                <a href="Functions.html#/s:14RxBluetoothKit2eeoiySbAA7ServiceC_ADtF">==(_:_:)</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="Protocols.html">Protocols</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Protocols/CharacteristicIdentifier.html">CharacteristicIdentifier</a>
              </li>
              <li class="nav-group-task">
                <a href="Protocols/DescriptorIdentifier.html">DescriptorIdentifier</a>
              </li>
              <li class="nav-group-task">
                <a href="Protocols/Logger.html">Logger</a>
              </li>
              <li class="nav-group-task">
                <a href="Protocols/ManagerType.html">ManagerType</a>
              </li>
              <li class="nav-group-task">
                <a href="Protocols/ServiceIdentifier.html">ServiceIdentifier</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="Structs.html">Structures</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Structs/AdvertisementData.html">AdvertisementData</a>
              </li>
              <li class="nav-group-task">
                <a href="Structs/CentralManagerRestoredState.html">CentralManagerRestoredState</a>
              </li>
              <li class="nav-group-task">
                <a href="Structs/PeripheralManagerRestoredState.html">PeripheralManagerRestoredState</a>
              </li>
              <li class="nav-group-task">
                <a href="Structs/RestoredState.html">RestoredState</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="Typealiases.html">Type Aliases</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Typealiases.html#/s:14RxBluetoothKit19DisconnectionReasona">DisconnectionReason</a>
              </li>
              <li class="nav-group-task">
                <a href="Typealiases.html#/s:14RxBluetoothKit32OnWillRestoreCentralManagerStatea">OnWillRestoreCentralManagerState</a>
              </li>
              <li class="nav-group-task">
                <a href="Typealiases.html#/s:14RxBluetoothKit35OnWillRestorePeripheralManagerStatea">OnWillRestorePeripheralManagerState</a>
              </li>
              <li class="nav-group-task">
                <a href="Typealiases.html#/s:14RxBluetoothKit18OnWillRestoreStatea">OnWillRestoreState</a>
              </li>
              <li class="nav-group-task">
                <a href="Typealiases.html#/s:14RxBluetoothKit25RestoredAdvertisementDataa">RestoredAdvertisementData</a>
              </li>
            </ul>
          </li>
        </ul>
      </nav>
      <article class="main-content">
        <section>
          <section class="section">
            <h1>Classes</h1>
            <p>The following classes are available globally.</p>

          </section>
          <section class="section task-group-section">
            <div class="task-group">
              <ul>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:14RxBluetoothKit14CentralManagerC"></a>
                    <a name="//apple_ref/swift/Class/CentralManager" class="dashAnchor"></a>
                    <a class="token" href="#/s:14RxBluetoothKit14CentralManagerC">CentralManager</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>CentralManager is a class implementing ReactiveX API which wraps all Core Bluetooth Manager&rsquo;s functions allowing to
discover, connect to remote peripheral devices and more.
You can start using this class by discovering available services of nearby peripherals. Before calling any
public <code>CentralManager</code>&lsquo;s functions you should make sure that Bluetooth is turned on and powered on.
It can be done by calling and observing returned value of <code>observeStateWithInitialValue()</code> and then
chaining it with <code>scanForPeripherals(_:options:)</code>:</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">disposable</span> <span class="o">=</span> <span class="n">centralManager</span><span class="o">.</span><span class="nf">observeStateWithInitialValue</span><span class="p">()</span>
    <span class="o">.</span><span class="n">filter</span> <span class="p">{</span> <span class="nv">$0</span> <span class="o">==</span> <span class="o">.</span><span class="n">poweredOn</span> <span class="p">}</span>
    <span class="o">.</span><span class="nf">take</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
    <span class="o">.</span><span class="n">flatMap</span> <span class="p">{</span> <span class="n">centralManager</span><span class="o">.</span><span class="nf">scanForPeripherals</span><span class="p">(</span><span class="kc">nil</span><span class="p">)</span> <span class="p">}</span>
</code></pre>

<p>As a result you will receive <code><a href="Classes/ScannedPeripheral.html">ScannedPeripheral</a></code> which contains <code><a href="Classes/Peripheral.html">Peripheral</a></code> object, <code><a href="Structs/AdvertisementData.html">AdvertisementData</a></code> and
peripheral&rsquo;s RSSI registered during discovery. You can then <code>establishConnection(_:options:)</code> and do other operations.
You can also simply stop scanning with just disposing it:</p>
<pre class="highlight swift"><code><span class="n">disposable</span><span class="o">.</span><span class="nf">dispose</span><span class="p">()</span>
</code></pre>
<div class="aside aside-seealso">
    <p class="aside-title">Seealso</p>
    <code><a href="Classes/Peripheral.html">Peripheral</a></code>

</div>

                        <a href="Classes/CentralManager.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">CentralManager</span> <span class="p">:</span> <span class="kt"><a href="Protocols/ManagerType.html">ManagerType</a></span></code></pre>

                        </div>
                      </div>
                      <div class="slightly-smaller">
                        <a href="https://github.com/Polidea/RxBluetoothKit/tree/7.0.0/Source/CentralManager.swift#L27-L352">Show on GitHub</a>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:14RxBluetoothKit14CharacteristicC"></a>
                    <a name="//apple_ref/swift/Class/Characteristic" class="dashAnchor"></a>
                    <a class="token" href="#/s:14RxBluetoothKit14CharacteristicC">Characteristic</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Characteristic is a class implementing ReactiveX which wraps CoreBluetooth functions related to interaction with <a href="https://developer.apple.com/library/ios/documentation/CoreBluetooth/Reference/CBCharacteristic_Class/">CBCharacteristic</a></p>

                        <a href="Classes/Characteristic.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">Characteristic</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Characteristic</span><span class="p">:</span> <span class="kt">Equatable</span></code></pre>

                        </div>
                      </div>
                      <div class="slightly-smaller">
                        <a href="https://github.com/Polidea/RxBluetoothKit/tree/7.0.0/Source/Characteristic.swift#L6-L180">Show on GitHub</a>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:14RxBluetoothKit10DescriptorC"></a>
                    <a name="//apple_ref/swift/Class/Descriptor" class="dashAnchor"></a>
                    <a class="token" href="#/s:14RxBluetoothKit10DescriptorC">Descriptor</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Descriptor is a class implementing ReactiveX which wraps CoreBluetooth functions related to interaction with
<a href="https://developer.apple.com/library/ios/documentation/CoreBluetooth/Reference/CBDescriptor_Class/">CBDescriptor</a>
Descriptors provide more information about a characteristic’s value.</p>

                        <a href="Classes/Descriptor.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">Descriptor</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Descriptor</span><span class="p">:</span> <span class="kt">Equatable</span></code></pre>

                        </div>
                      </div>
                      <div class="slightly-smaller">
                        <a href="https://github.com/Polidea/RxBluetoothKit/tree/7.0.0/Source/Descriptor.swift#L8-L104">Show on GitHub</a>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:14RxBluetoothKit0abC3LogC"></a>
                    <a name="//apple_ref/swift/Class/RxBluetoothKitLog" class="dashAnchor"></a>
                    <a class="token" href="#/s:14RxBluetoothKit0abC3LogC">RxBluetoothKitLog</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>RxBluetoothKit specific logging class which gives access to its settings.</p>

                        <a href="Classes/RxBluetoothKitLog.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">RxBluetoothKitLog</span> <span class="p">:</span> <span class="kt">ReactiveCompatible</span></code></pre>

                        </div>
                      </div>
                      <div class="slightly-smaller">
                        <a href="https://github.com/Polidea/RxBluetoothKit/tree/7.0.0/Source/Logging.swift#L6-L105">Show on GitHub</a>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:14RxBluetoothKit10PeripheralC"></a>
                    <a name="//apple_ref/swift/Class/Peripheral" class="dashAnchor"></a>
                    <a class="token" href="#/s:14RxBluetoothKit10PeripheralC">Peripheral</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Peripheral is a class implementing ReactiveX API which wraps all Core Bluetooth functions
allowing to talk to peripheral like discovering characteristics, services and all of the read/write calls.</p>

                        <a href="Classes/Peripheral.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">Peripheral</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Peripheral</span><span class="p">:</span> <span class="kt">Equatable</span></code></pre>

                        </div>
                      </div>
                      <div class="slightly-smaller">
                        <a href="https://github.com/Polidea/RxBluetoothKit/tree/7.0.0/Source/Peripheral.swift#L10-L873">Show on GitHub</a>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:14RxBluetoothKit17PeripheralManagerC"></a>
                    <a name="//apple_ref/swift/Class/PeripheralManager" class="dashAnchor"></a>
                    <a class="token" href="#/s:14RxBluetoothKit17PeripheralManagerC">PeripheralManager</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>PeripheralManager is a class implementing ReactiveX API which wraps all the Core Bluetooth Peripheral&rsquo;s functions, that allow to
advertise, to publish L2CAP channels and more.
You can start using this class by adding services and starting advertising.
Before calling any public <code>PeripheralManager</code>&lsquo;s functions you should make sure that Bluetooth is turned on and powered on. It can be done
by <code>observeStateWithInitialValue()</code>, observing it&rsquo;s value and then chaining it with <code>add(_:)</code> and <code>startAdvertising(_:)</code>:</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">disposable</span> <span class="o">=</span> <span class="n">centralManager</span><span class="o">.</span><span class="nf">observeStateWithInitialValue</span><span class="p">()</span>
    <span class="o">.</span><span class="n">filter</span> <span class="p">{</span> <span class="nv">$0</span> <span class="o">==</span> <span class="o">.</span><span class="n">poweredOn</span> <span class="p">}</span>
    <span class="o">.</span><span class="nf">take</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
    <span class="o">.</span><span class="n">flatMap</span> <span class="p">{</span> <span class="n">centralManager</span><span class="o">.</span><span class="nf">add</span><span class="p">(</span><span class="n">myService</span><span class="p">)</span> <span class="p">}</span>
    <span class="o">.</span><span class="n">flatMap</span> <span class="p">{</span> <span class="n">centralManager</span><span class="o">.</span><span class="nf">startAdvertising</span><span class="p">(</span><span class="n">myAdvertisementData</span><span class="p">)</span> <span class="p">}</span>
</code></pre>

<p>As a result, your peripheral will start advertising. To stop advertising simply dispose it:</p>
<pre class="highlight swift"><code><span class="n">disposable</span><span class="o">.</span><span class="nf">dispose</span><span class="p">()</span>
</code></pre>

                        <a href="Classes/PeripheralManager.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">PeripheralManager</span> <span class="p">:</span> <span class="kt"><a href="Protocols/ManagerType.html">ManagerType</a></span></code></pre>

                        </div>
                      </div>
                      <div class="slightly-smaller">
                        <a href="https://github.com/Polidea/RxBluetoothKit/tree/7.0.0/Source/PeripheralManager.swift#L21-L391">Show on GitHub</a>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:14RxBluetoothKit17ScannedPeripheralC"></a>
                    <a name="//apple_ref/swift/Class/ScannedPeripheral" class="dashAnchor"></a>
                    <a class="token" href="#/s:14RxBluetoothKit17ScannedPeripheralC">ScannedPeripheral</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Represents instance of scanned peripheral - containing it&rsquo;s advertisment data, rssi and peripheral itself.
To perform further actions <code>peripheral</code> instance variable can be used ia. to maintain connection.</p>

                        <a href="Classes/ScannedPeripheral.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">ScannedPeripheral</span></code></pre>

                        </div>
                      </div>
                      <div class="slightly-smaller">
                        <a href="https://github.com/Polidea/RxBluetoothKit/tree/7.0.0/Source/ScannedPeripheral.swift#L6-L22">Show on GitHub</a>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:14RxBluetoothKit7ServiceC"></a>
                    <a name="//apple_ref/swift/Class/Service" class="dashAnchor"></a>
                    <a class="token" href="#/s:14RxBluetoothKit7ServiceC">Service</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Service is a class implementing ReactiveX which wraps CoreBluetooth functions related to interaction with <a href="https://developer.apple.com/library/ios/documentation/CoreBluetooth/Reference/CBService_Class/">CBService</a></p>

                        <a href="Classes/Service.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">Service</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Service</span><span class="p">:</span> <span class="kt">Equatable</span></code></pre>

                        </div>
                      </div>
                      <div class="slightly-smaller">
                        <a href="https://github.com/Polidea/RxBluetoothKit/tree/7.0.0/Source/Service.swift#L6-L81">Show on GitHub</a>
                      </div>
                    </section>
                  </div>
                </li>
              </ul>
            </div>
          </section>
        </section>
        <section id="footer">
          <p>&copy; 2021 <a class="link" href="https://polidea.com" target="_blank" rel="external">Polidea</a>. All rights reserved. (Last updated: 2021-02-10)</p>
          <p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
        </section>
      </article>
    </div>
  </body>
</div>
</html>
